package testcases.OpportunitiesBaseDataView.FilterContent;
import resources.testcases.OpportunitiesBaseDataView.FilterContent.UI002_Opportunities_Base_Data_View_Seller_Filter_ITSHelper;
import tasks.Loading;
import tasks.OpportunitiesBaseData.Filters.Applier;
import tasks.OpportunitiesBaseData.Filters.FilterLayoutTemplate;
import tasks.OpportunitiesBaseData.Filters.SelectBoxVal;
import tasks.OpportunitiesBaseData.Filters.Verifier;

import com.rational.test.ft.*;
import com.rational.test.ft.object.interfaces.*;
import com.rational.test.ft.object.interfaces.SAP.*;
import com.rational.test.ft.object.interfaces.WPF.*;
import com.rational.test.ft.object.interfaces.dojo.*;
import com.rational.test.ft.object.interfaces.siebel.*;
import com.rational.test.ft.object.interfaces.flex.*;
import com.rational.test.ft.object.interfaces.generichtmlsubdomain.*;
import com.rational.test.ft.script.*;
import com.rational.test.ft.value.*;
import com.rational.test.ft.vp.*;
import com.ibm.rational.test.ft.object.interfaces.sapwebportal.*;

import core.Configurations;
import core.ControlsMapping;
import core.Preconditions;
import core.controls.SelectBox;
import core.enums.Reports;
import core.testcases.TestProjectSuperHelper;
/**
 * Description   : Functional Test Script
 * @author angel.tsvetkov
 */
public class UI002_Opportunities_Base_Data_View_Seller_Filter_ITS extends UI002_Opportunities_Base_Data_View_Seller_Filter_ITSHelper
{
	private boolean stepResult = false;
	private Verifier filterVerifier = new Verifier();

	private boolean testCasePreconditions() {
		boolean preconditionResult = false;

		preconditionResult = Preconditions.globalPreconditionCognos(Reports.OpportunitiesBaseDataView);

		return preconditionResult;
	}

    public void executeTest()
    {
        beginTestCase("",
                      "Verify content of Seller Filter list boxes for ITS brand.",
                      "",
                      "Angel Tsvetkov",
                      "",
                      "");
        
        if (testCasePreconditions())
        {     
        	TimeWait(3);
        	
        	stepResult = ControlsMapping.FilterCommonElements.showAll_link.clickLink();
        	setStepResult(stepResult, "Click " + ControlsMapping.FilterCommonElements.showAll_link.getDescriptiveName());
        	
        	Loading.waitToComplete();
        	
        	Applier apply = new Applier();
        	stepResult = apply.applyProductFilter("ITS", null, null, null, null, null, null, null, null, null, null, null,false);
        	setStepResult(stepResult, "Switch to ITS brand in " + ControlsMapping.ProductFilter.BrandOfferingType_listbox.getDescriptiveName());
        	
        	TimeWait(3);
        	stepResult = ControlsMapping.ProductFilter.updateFilter_button.clickButton();
        	setStepResult(stepResult, "Press " + ControlsMapping.ProductFilter.updateFilter_button.getDescriptiveName());
        	
        	Loading.waitToComplete();

        	stepResult = !ControlsMapping.SellerFilter.TerritoryType_listbox.isExist();
        	setStepResult(stepResult, "Check wheather " + ControlsMapping.SellerFilter.TerritoryType_listbox.getDescriptiveName() + " exists.");
        	
        	Loading.waitToComplete();

        	stepResult = filterVerifier.verify("Seller_Role.sql" , ControlsMapping.SellerFilter.TerritoryType_listbox, "ITS");
        	setStepResult(stepResult, "Verify Role list box content!" );
        	
        	stepResult = filterVerifier.verify("Seller_SellerName.sql" , ControlsMapping.SellerFilter.Role_listbox, "ITS");
        	setStepResult(stepResult, "Verify Seller Name list box content!" );

        	TimeWait(1);
        }
    }
    
    public void testMain(Object[] args)
    {
    	setUp(args);
        executeTest();
        reportTestCaseResult(TestProjectSuperHelper.testCase.getTestCaseDescription() , Configurations.PROJECT_NAME);
    }
}

